# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils cmake-utils flag-o-matic

DESCRIPTION="Package and theme installer for qutIM"
HOMEPAGE="http://qutim.org/forum/viewtopic.php?f=55&t=860&p=10761#p10761"
LICENSE="GPL-2"
SRC_URI="http://sauron.savel.pp.ru:8090/dist-files/qutim-plugman/${PN}-${PV}.tar.gz
	http://www.svtdpi.com.ua/sqee/qutim/plugins/${PN}-${PV}.tar.gz"

SLOT="0.2"
KEYWORDS="~x86 ~amd64 ~ppc ~ppc64"
IUSE="debug tools"

RDEPEND="net-im/qutim:0.2
	sys-libs/zlib"

DEPEND="${RDEPEND}
        >=dev-util/cmake-2.6
	!x11-plugins/qutim-plugman:live"

RESTRICT="mirror
	debug? ( strip )"

S=${WORKDIR}/${PN}

src_prepare()
{
	if (use debug) ; then
		unset CFLAGS CXXFLAGS
		append-flags -O1 -g -ggdb
	fi
	append-flags -fPIC

	if (use tools) ; then
		mycmakeargs="-DTOOLS=true"
	fi

	mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=/usr -DAPPLE=0 -DUNIX=1"

	CMAKE_IN_SOURCE_BUILD=1

	sed -i "/DESTINATION/s/lib/$(get_libdir)/g" ${S}/CMakeLists.txt
}

src_install()
{
	cmake-utils_src_install
}
